package org.desktop.web.server.util;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

import org.json.JSONException;
import org.json.JSONObject;

public class Util {

	public static Map<String, Object> toMap(JSONObject obj) throws JSONException{
		Map<String, Object> map = new HashMap<String, Object>();
		Iterator<String> it = obj.keys();
		while (it.hasNext()) {
			String key = (String) it.next();
			Object o = obj.get(key);
			if((o instanceof Serializable)){
				map.put(key, o);
			}
		}
		return map;
	}
}
